package com.github.caijinglong.handler

import com.github.caijinglong.SaveDataHandler
import com.github.caijinglong.SavedDataType
import com.github.caijinglong.getGetter
import org.json.JSONObject

class HealthHandler : SaveDataHandler {
    override var jsonObject: JSONObject = JSONObject()

    fun maxHealth() {
        val max = jsonObject.getInt("max_health")
        jsonObject.put("current_health", max)
    }

    companion object {
        @JvmStatic
        fun main(args: Array<String>) {
            HealthHandler().apply {
                bind(SavedDataType.ZS.getGetter())
                maxHealth()
                save(SavedDataType.ZS.srcPath)
            }
        }
    }
}